home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / falcon / nt_dsp2.lzh / NT_DSP2.MSA / BENCH / 2-56.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-07-18  |  4.2 KB  |  110 lines

  1.     page 132,66,0,6
  2.     opt    rc
  3. ;*******************************************
  4. ;Motorola Austin DSP Operation  June 30,1988
  5. ;*******************************************
  6. ;DSP56000/1
  7. ;64 tap FIR filter
  8. ;File name: 2-56.asm
  9. ;**************************************************************************
  10. ;    Maximum sample rate: 144.4 Khz at 20.5 MHZ/ 190.1 KHz at 27.0 MHz
  11. ;    Memory Size: Prog: 4+6 words ; Data :2 x 64 words
  12. ;    Number of clock cycles:    142 (71 instruction cycles)
  13. ;    Clock Frequency:    20.5MHz/27.0MHz
  14. ;    Cycle time:        97.5ns /  74.1ns
  15. ;**************************************************************************
  16. ;    This FIR filter reads the input sample
  17. ;    from the memory location Y:input
  18. ;    and writes the filtered output sample
  19. ;    to the memory location Y:output
  20. ;
  21. ;    The samples are stored in the X memory
  22. ;    The coefficients are stored in the Y memory
  23. ;**************************************************************************
  24. ;
  25. ;          X MEMORY                               Y MEMORY
  26. ;
  27. ;         |        |                             |        |
  28. ;    R0   |--------|                             |--------|
  29. ;  +----->|  X(n)  |                      +----->|  c(0)  |
  30. ;  |  t   |--------|                      |t,t+T |--------|
  31. ;  |      | X(n-1) |                      |      |  c(1)  |
  32. ;  |      |--------|                      |      |--------|
  33. ;  |      |        |                      |      |        |
  34. ;  |      |        |                      |      |        |
  35. ;  |      |        |                      |      |        |
  36. ;  |      |        |                      |      |        |
  37. ;  |      |--------|                      |      |--------|
  38. ;  +----->|X(n-k+1)|  X(n+1)              +<-----| c(k-1) |
  39. ;   t+T   |--------|                             |--------|
  40. ;         |        |                             |        |
  41. ;
  42. ;
  43. ;                              C(0)                      
  44. ;                              ___          ___
  45. ;    x(n)                     /   \        /   \         y(n)
  46. ;    -------------+----------|  X  |----->|  +  |--------->
  47. ;                 |           \___/        \___/
  48. ;                 |                          ^             k-1
  49. ;                 |                          |             ____
  50. ;              +-----+                       |             \   '
  51. ;              |  T  |         C(1)          |      y(n)=  /___,c(p)x(n-p)
  52. ;              +-----+         ___           |             p=0
  53. ;                 |           /   \          |
  54. ;                 +----------|  X  |-------->+  
  55. ;                 |           \___/          |
  56. ;              +-----+                       |
  57. ;              |  T  |         C(2)          |
  58. ;              +-----+         ___           |
  59. ;                 |           /   \          |
  60. ;                 +----------|  X  |-------->+   
  61. ;                 |           \___/          |
  62. ;                 |                          |
  63. ;                 |                          |
  64. ;                 |                          |
  65. ;                 |                          |
  66. ;                 |                          |
  67. ;                 |                          |
  68. ;              +-----+                       |
  69. ;              |  T  |         C(K-1)        |
  70. ;              +-----+         ___           |
  71. ;                 |           /   \          |
  72. ;                 +----------|  X  |-------->+     
  73. ;                             \___/
  74. ;
  75. ;
  76. ;                            F I R
  77. ;
  78. ;**************************************************************************
  79. ;
  80. ;    initialization
  81. ;**********************
  82. n    equ    64
  83. start    equ    $40
  84. wddr    equ    $0
  85. cddr    equ    $0
  86. input    equ    $ffe0
  87. output    equ    $ffe1
  88. ;
  89.     org    p:start
  90.     move     #wddr,r0        ;r0 -> samples
  91.     move    #cddr,r4        ;r4 -> coefficients
  92.     move     #n-1,m0            ;set modulo arithmetic
  93.     move    m0,m4            ;for the 2 circular buffers
  94. ;
  95.     opt    cc
  96. ;    filter loop :8+(n-1) cycles
  97. ;***************************************************************
  98.     movep     y:input,x:(r0)        ;input sample in memory
  99.     clr    a    x:(r0)+,x0    y:(r4)+,y0
  100.  
  101.     rep    #n-1
  102.     mac    x0,y0,a    x:(r0)+,x0     y:(r4)+,y0
  103.     macr    x0,y0,a    (r0)-
  104.  
  105.     movep    a,y:output        ;output filtered sample
  106. ;***************************************************************
  107.     end
  108.  
  109.  
  110.